import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { UserManagementComponent } from './user-management.component';
import { UserManagementRoutes } from './user-management.routing';
import { PaginationModule } from '../shared/pagination/pagination.module';
import { MaterialModule } from '../app.module';
import { authHttpProvider } from '../interceptor/auth-http';
import { LeftSidebarService } from '../sidebar/left-sidebar-service';
import * as FORMAT from '../common/date-picker-format';
import { MomentDateAdapter } from '@angular/material-moment-adapter';
import {
    DateAdapter,
    MAT_DATE_FORMATS,
    MAT_DATE_LOCALE
} from '@angular/material/core';

@NgModule({
    imports: [
        CommonModule,
        RouterModule.forChild(UserManagementRoutes),
        FormsModule,
        PaginationModule,
        MaterialModule
    ],
    declarations: [UserManagementComponent],
    providers: [
        authHttpProvider(),
        { provide: LeftSidebarService, useClass: LeftSidebarService },
        { provide: MAT_DATE_LOCALE, useValue: 'zh-CN' },
        {
            provide: DateAdapter,
            useClass: MomentDateAdapter,
            deps: [MAT_DATE_LOCALE]
        },
        { provide: MAT_DATE_FORMATS, useValue: FORMAT.MAT_FORMAT_YYYYMMDD }
    ]
})
export class UserManagementModule {}
